﻿using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;

namespace SubStationManagement.Server.Models
{
    public class Target
    {
        [BsonId]
        [BsonRepresentation(BsonType.ObjectId)]
        [Display(Name = "Id")]
        [NotNull]
        public string? Id { get; set; }

        /// <summary>
        /// 获得/设置 测控目标名
        /// </summary>
        [Display(Name = "测控目标名")]
        [NotNull, Required]
        public string? Name { get; set; }

        /// <summary>
        /// 获得/设置 目标类型
        /// </summary>
        [Display(Name = "目标类型")]
        [NotNull, Required]
        public EnumTargetType Type { get; set; }

        /// <summary>
        /// 获得/设置 测控模块
        /// </summary>
        [Display(Name = "测控模块")]
        public string? MeasureModuleId { get; set; }

        /// <summary>
        /// 获得/设置 测控模块回路
        /// </summary>
        [Display(Name = "测控模块回路")]
        public EnumMeasureLoopNumber? MeasureModuleLoop { get; set; }

        /// <summary>
        /// 获得/设置 DIDO模块
        /// </summary>
        [Display(Name = "DIDO模块")]
        public string? DIDOModuleId { get; set; }

        /// <summary>
        /// 获得/设置 DIDO模块通道
        /// </summary>
        [Display(Name = "DIDO模块通道")]
        public EnumDIDOModuleChannel? DIDOModuleChannel { get; set; }

        /// <summary>
        /// 获得/设置 录波模块
        /// </summary>
        [Display(Name = "录波模块")]
        public string? RecordingModuleId { get; set; }

        /// <summary>
        /// 获得/设置 录波模块回路
        /// </summary>
        [Display(Name = "录波模块回路")]
        public EnumRecordingLoopNumber? RecordingModuleLoop { get; set; }

        /// <summary>
        /// 获得/设置 主站联动
        /// </summary>
        [Display(Name = "主站联动")]
        [NotNull, Required]
        public bool Foward { get; set; }

        /// <summary>
        /// 获得/设置 Enable
        /// </summary>
        [Display(Name = "启用")]
        [NotNull, Required]
        public bool Enable { get; set; }
    }

    public enum EnumTargetType
    {
        /// <summary>
        /// 
        /// </summary>
        [Description("电源")]
        Source,

        /// <summary>
        /// 
        /// </summary>
        [Description("负荷")]
        Load,

        /// <summary>
        /// 
        /// </summary>
        [Description("变压器")]
        Transformer,

        /// <summary>
        /// 
        /// </summary>
        [Description("开关")]
        Others
    }

    public enum EnumMeasureLoopNumber
    {
        /// <summary>
        /// 
        /// </summary>
        [Description("回路1")]
        L1,
        /// <summary>
        /// 
        /// </summary>
        [Description("回路2")]
        L2,
        /// <summary>
        /// 
        /// </summary>
        [Description("回路3")]
        L3,
        /// <summary>
        /// 
        /// </summary>
        [Description("回路4")]
        L4
    }

    public enum EnumDIDOModuleChannel
    {
        /// <summary>
        /// 
        /// </summary>
        [Description("输入1")]
        DI1,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入2")]
        DI2,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入3")]
        DI3,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入4")]
        DI4,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入5")]
        DI5,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入6")]
        DI6,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入7")]
        DI7,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入8")]
        DI8,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入9")]
        DI9,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入10")]
        DI10,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入11")]
        DI11,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入12")]
        DI12,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入13")]
        DI13,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入14")]
        DI14,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入15")]
        DI15,
        /// <summary>
        /// 
        /// </summary>
        [Description("输入16")]
        DI16,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出1")]
        DO1,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出2")]
        DO2,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出3")]
        DO3,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出4")]
        DO4,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出5")]
        DO5,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出6")]
        DO6,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出7")]
        DO7,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出8")]
        DO8,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出9")]
        DO9,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出10")]
        DO10,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出11")]
        DO11,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出12")]
        DO12,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出13")]
        DO13,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出14")]
        DO14,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出15")]
        DO15,
        /// <summary>
        /// 
        /// </summary>
        [Description("输出16")]
        DO16,
    }

    public enum EnumRecordingLoopNumber
    {
        /// <summary>
        /// 
        /// </summary>
        [Description("回路1 （A1 - A6)")]
        L1,
        /// <summary>
        /// 
        /// </summary>
        [Description("回路2 （A7 - A12)")]
        L2,
    }

}
